package cn.itcast.cd.resultPage;

import java.util.ArrayList;
import java.util.List;

public class ResultPage {

	private int currentPage;
	private int rowCount;
	private int pageSize;
	private int prePage;
	private int nextPage;
	private int totalPage;
	private List result = new ArrayList();
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getRowCount() {
		return rowCount;
	}
	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getPrePage() {
		//如果当前面大于1,则有上一页.否则就是第一页.
		return currentPage>1?currentPage-1:1;
	}
	
	public int getNextPage() {
		//这里要调用totalPage的方法.否则是没有值 的.
		return currentPage<getTotalPage()?currentPage+1:currentPage;
	}
	public int getTotalPage() {
		//这里算总的页数,因为JAVA算法的原因,小数都要舍去,所以我们先加一页,再减一条数据.这样就OK了.
		return (rowCount+pageSize-1)/pageSize;
	}
	
	public List getResult() {
		return result;
	}
	public void setResult(List result) {
		this.result = result;
	}
	
	
}
